<template>
  <!-- 审核日志 -->
<div>
  <div class="form">
    <el-input class="input" v-model="obj.idorname" placeholder="请输入审核人姓名" />
    <text><el-button class="botton" type="primary">查询</el-button></text>
  </div>

  <!-- 表格 -->
  <div>

    <el-table ref="multipleTableRef" :data="tableData" style="width: 100%" border  height="540" class="tab">
    <el-table-column property="username" align="center" label="审核人" width="190" />
    <el-table-column property="userid" align="center" label="来访人" width="190" />
    <el-table-column property="author" align="center" label="来访人电话" width="190" />
    <el-table-column property="author" align="center" label="来访车牌号" width="190" />
    <el-table-column property="addtime" align="center" label="审核时间" width="190" />

    <el-table-column property="status" align="center" label="审核状态" #default="scope" width="190" >
      <el-tag v-if="scope.row.status===1">
          {{ scope.row.status===1?"一审":''}}
      </el-tag>
      <el-tag type="success" v-else-if="scope.row.status===2">
        {{scope.row.status===2? '二审':''}}
      </el-tag>
      <el-tag type="info" v-else="scope.row.status===3">
        {{scope.row.status===3? '终审':''}}
      </el-tag>
    </el-table-column>
  
    <el-table-column label="操作" align="center">

      <template #default="scope">
          <el-button type="info" @click="xiangqing(scope.row.logid)">详情</el-button>
      </template>

    </el-table-column>
  </el-table>

  </div>


  <!-- 分页 -->
  <FenYe :total="totals" @getChildData='getChildData'></FenYe>



</div>
</template>

<script setup lang='ts'>
import { ref,reactive } from 'vue';
import {auditlog} from '../../api/login/index' //接口
import router from "../../router/router";
import FenYe from '../../components/fen ye/FenYe.vue'


// 列表数据
let tableData:any = ref([])
let totals:any = ref(0)  // 一共多少条数据
const obj = reactive({  //参数
  page: '1',
  pageSize: '10',
  idorname: '',
})
let list = async() =>{
  let res:any = await auditlog(obj)
  console.log(res);
  // 防止往下追加
  tableData.length = 0
  tableData.value = res.data
  // 一共多少条数据
  totals.value = res.total
}
list()

// 分页
const getChildData = (val:any) => {
  console.log(111, val)
  obj.page = val.page
  obj.pageSize = val.pageSize
  list()
}

// 详情
let xiangqing = (id:any) =>{
  router.push({path:'jxiangqing', query: {id}})
}




</script>

<style scoped lang='less'>
.form{
  margin-bottom: 30px;
}
.input{
  width: 230px;
}
.botton{
  margin-left: 20px;
}
</style>